/*
 * @Author: fzs
 * @Date: 2019-01-10 13:55:42
 * @LastEditors: fzs
 * @LastEditTime: 2019-01-10 14:02:59
 * @Description: 数据库连接池
 */

 const mysql = require('mysql');
 
 let db = mysql.createPool({host:'localhost',user:'root',password:'admin',port:3306, database:'mydatabase'}); //maxConnection:'10' 此为隐藏参数。默认10个链接，一般够用了
 db.query('select * from user',(err,data)=>{
    if(err){
        console.log('错了',err);
    }
    console.log(data);
});